import http from '../utils/http'

export const reLogin = (loginData) => {
  return http.post('/user/login',loginData,  {
    header: {
    'Content-Type': 'application/x-www-form-urlencoded'
  }
})
}
export const reqUserInfo = () => {
  //获取用户信息
  return http.get('/miniWeight/getWeight')
}

export const reqUser = () => {
  //获取用户信息
  return http.get('/user/userInfo')
}

// 修改初始体重
export const updateInitWeight = (weight) => {
  // 将数据转换为 x-www-form-urlencoded 格式
  const data = `weight=${encodeURIComponent(weight)}`
  return http.put('/miniWeight/updateInitWeight', data, {
    header: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
// 修改当前体重
export const updateCurrentWeight = (weight) => {
  // 将数据转换为 x-www-form-urlencoded 格式
  const data = `weight=${encodeURIComponent(weight)}`
  return http.put('/miniWeight/updateCurrentWeight', data, {
    header: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
// 修改目标体重
export const updateTargetWeight = (weight) => {
  // 将数据转换为 x-www-form-urlencoded 格式
  const data = `weight=${encodeURIComponent(weight)}`
  return http.put('/miniWeight/updateTargetWeight', data, {
    header: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
// export const updateInitWeight = (weight) => {
//   return http.put('/updateInitWeight', {
//     weight: weight
//   });
// };